package com.lovetemperature.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.Type;

@Entity
@Table(name="orders")
public class Order {
	@Id
	@GeneratedValue
	private Long orderNum;
	@ManyToOne
	@JoinColumn(name="customerId")
	private Member customer;
	@Temporal(TemporalType.TIMESTAMP)
	private Date putOrderDate;
	@Temporal(TemporalType.DATE)
	private Date pickupDate;
	@LazyCollection(LazyCollectionOption.FALSE)
	@OneToOne
	@Cascade(value=CascadeType.SAVE_UPDATE)
	private GoodSet goodSet;
	private double totalPrice;
	private String phone;
	private String address;
	private String payNum;
	@ManyToOne
	private Shop shop;
	private Boolean finished;
	
	public Order(){finished=false;}
	public Long getOrderNum() {
		return orderNum;
	}
	public void setOrderNum(Long orderNum) {
		this.orderNum = orderNum;
	}
	public Member getCustomer() {
		return customer;
	}
	public void setCustomer(Member customer) {
		this.customer = customer;
	}
	public Date getPutOrderDate() {
		return putOrderDate;
	}
	public void setPutOrderDate(Date putOrderDate) {
		this.putOrderDate = putOrderDate;
	}
	public Date getPickupDate() {
		return pickupDate;
	}
	public void setPickupDate(Date pickupDate) {
		this.pickupDate = pickupDate;
	}
	public double getTotalPrice() {
		return totalPrice;
	}
	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getPayNum() {
		return payNum;
	}
	public void setPayNum(String payNum) {
		this.payNum = payNum;
	}
	public GoodSet getGoodSet() {
		return goodSet;
	}
	public void setGoodSet(GoodSet goodSet) {
		this.goodSet = goodSet;
	}
	public Shop getShop() {
		return shop;
	}
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	public Boolean getFinished() {
		return finished;
	}
	public void setFinished(Boolean finished) {
		this.finished = finished;
	}
}
